<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-08-28 09:24:15
 * @Description: 租户基础信息表
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-09-07 11:00:39
 * @FilePath: /qingshanERP/database/migrations/qingshanerp/2021_08_28_092415_create_tenant.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTenant extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tenants', function (Blueprint $table) {
            $table->id();
            $table->foreignId('tenant_level_id')->default(0)->comment('租户级别id');
            $table->string('phone', 100)->nullable()->comment('电话');
            $table->string('tenant_name', 100)->comment('租户名称');
            $table->string('email')->default('ss@qq.com')->comment('邮箱');
            $table->char('crypt', 10)->default('1111111111')->comment('秘钥');
            $table->char('password', 50)->default('a')->comment('密码');
            $table->dateTime('last_date')->useCurrent()->comment('到期时间');
            $table->ipAddress('lastip')->default('0.0.0.0')->comment('最后登录 IP');
            $table->dateTime('lasttime')->useCurrent()->comment('最后登录时间');
            $table->boolean('status')->default(1)->comment('状态，1 正常，0 禁用');
            $table->boolean('del_flag')->default(0)->comment('删除状态，1 删除，0 未删除');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tenants');
    }
}
